package com.aspose.cells;

class ztx {
   private zbmu a;

   ztx(zbmu var1) {
      this.a = var1;
   }

   void a(zcfx var1) throws Exception {
      var1.b(true);
      var1.b("slicerCacheDefinition");
      this.d(var1);
      this.b(var1);
      this.c(var1);
      if (this.a.f != null) {
         var1.d(this.a.f);
      }

      var1.b();
      var1.d();
      var1.e();
   }

   private void b(zcfx var1) throws Exception {
      int var2 = this.a.j().getCount();
      if (var2 > 0) {
         var1.b("pivotTables");

         for(int var3 = 0; var3 < var2; ++var3) {
            var1.b("pivotTable");
            var1.a("tabId", zase.y(this.a.j().a(var3).a()));
            var1.a("name", this.b(this.a.j().a(var3).b()));
            var1.b();
         }

         var1.b();
      }

   }

   private void c(zcfx var1) throws Exception {
      if (this.a.c() || this.a.o != null && this.a.b()) {
         var1.b("data");
         if (this.a.c()) {
            var1.b("tabular");
            var1.a("pivotCacheId", zase.a(this.a.h & 4294967295L));
            String var2 = zbng.b(this.a.i);
            if (!var2.equals("ascending")) {
               var1.a("sortOrder", var2);
            }

            if (!this.a.j) {
               var1.a("customListSort", "0");
            }

            var2 = zbng.a(this.a.k);
            if (!var2.equals("showItemsWithDataAtTop")) {
               var1.a("crossFilter", var2);
            }

            if (!this.a.l) {
               var1.a("showMissing", "0");
            }

            zbmy var3 = this.a.e();
            int var4 = var3.getCount();
            if (var4 > 0) {
               var1.b("items");
               var1.a("count", zase.y(var4));

               for(int var5 = 0; var5 < var4; ++var5) {
                  var1.b("i");
                  var1.a("x", zase.y(var3.a(var5).a));
                  if (var3.a(var5).b) {
                     var1.a("s", "1");
                  }

                  if (var3.a(var5).c) {
                     var1.a("nd", "1");
                  }

                  var1.b();
               }

               var1.b();
            }

            if (this.a.n != null) {
               var1.a(this.a.n);
            }

            var1.b();
         }

         if (this.a.o != null && this.a.b()) {
            var1.d(this.a.o);
         }

         var1.b();
      }
   }

   private boolean a(String var1) {
      return null == var1 || "".equals(var1);
   }

   private String b(String var1) {
      return this.a(var1) ? "" : var1;
   }

   private void d(zcfx var1) throws Exception {
      var1.a("xmlns", zase.f);
      var1.a("xmlns:mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
      var1.a("mc:Ignorable", "x");
      var1.a("xmlns:x", zase.c);
      var1.a("name", this.b(this.a.f()));
      var1.a("sourceName", this.b(this.a.g()));
   }
}
